package cn.smile.commons.constant;


import java.math.BigDecimal;

/**
 * @author smile-jt
 */
public class CommonConstant {
    public static final String SYS_FLAG_STRING = "microServer";
    public static final String SYS_FLAG_SALT = "PASSWORD";
    public static final String HEADER_TOKEN_KEY = "X-Access-Token";
    public static final String REQUEST_URL_FORMAT = "%s%s/%s";
    public static final String FILE_NAME_FORMAT = "%s%s";
    public static final String CONTENT_TYPE = "application/json;charset=utf-8";
    public static final String DEFAULT_NAME_STRING = "-";
    public static final String DEFAULT_AVATAR_URL = "https://smile-jt.cn/minio/micro-files/default.png";
    public static final String DEFAULT_NICK_NAME = "用户—%s";
    public static final String DEFAULT_USER_ROLE_CODE = "user";
    public static final String EXCEL_FILE_SUFFIX_XLSX = ".xlsx";
    public static final String EXCEL_FILE_SUFFIX_XLS = ".xls";
    public static final String ROOT_PARENT_ID = "-1";
    public static final String ROOT_PARENT_SELECT_NAME = "顶级菜单";
    @SuppressWarnings("unused")
    public static final String LOGIN_ID_RULE = "^[a-zA-Z0-9_-]{5,50}$";
    @SuppressWarnings("unused")
    public static final String EMAIL_RULE = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$";
    public static final String ROLE_CODE_RULE = "^[a-zA-Z0-9_-]{4,50}$";
    public static final String YES = "是";
    public static final String NO = "否";
    public static final BigDecimal DEFAULT_PRICE = new BigDecimal("0.00");
    public static final String DEFAULT_SWIPER_ID = "-1";

    /**
     * 正则校验字符串
     *
     * @param checkString 待校验的字符串
     * @param rule        正则表达式
     * @return 校验结果 true-符合, false-不符合
     */
    public static boolean checkRule(String checkString, String rule) {
        return checkString.matches(rule);
    }
}
